package com.intxt.bbs.controller;

import java.util.Date;

import com.intxt.bbs.model.Reply;
import com.intxt.bbs.model.User;
import com.jfinal.core.Controller;
import com.jfinal.plugin.activerecord.Page;

public class ReplyController extends Controller {
	public void index(){
		
	}
	
	public void save(){
		String topicId = getPara("topicId");
		String content  = getPara("replyContent");
		Reply reply = new Reply();
		reply.set("topic_id", topicId);
		reply.set("content",content);
		reply.set("reply_time", new Date());
		User u = (User) getSession().getAttribute("user");
		reply.set("user_id", u.getStr("id"));
		reply.save();
		redirect("/topic/detail?topicId="+topicId);
	}


}
